﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PacManLib;

namespace PacManAI_SampleAI
{
    /// <summary>
    /// A Pac-Man "AI" that moves based on the arrow keys.
    /// </summary>
    public class PacMan : IPacManAI
    {
        #region IPacManAI Members

        /// <summary>
        /// Returns the nickname of this AI.
        /// </summary>
        public string getAIName()
        {
            return "Manual Pac-Man";
        }

        /// <summary>
        /// Returns the coder's name.
        /// </summary>
        public string getCodersName()
        {
            return "Richard Shepherd";
        }

        /// <summary>
        /// Returns the desired direction for the Pac-Man to move.
        /// In this example, the Pac-Man is controlled manually by
        /// key presses.
        /// </summary>
        public PlayerInfo.Direction getDesiredDirection(Board board)
        {
            if (Keyboard.IsKeyDown(Keys.Up)) return PlayerInfo.Direction.Up;
            if (Keyboard.IsKeyDown(Keys.Down)) return PlayerInfo.Direction.Down;
            if (Keyboard.IsKeyDown(Keys.Left)) return PlayerInfo.Direction.Left;
            if (Keyboard.IsKeyDown(Keys.Right)) return PlayerInfo.Direction.Right;
            return PlayerInfo.Direction.NoChange;
        }

        #endregion
    }
}
